/*
 * @Author: bankeyu-dell 573569790@qq.com
 * @Date: 2022-10-08 15:53:59
 * @LastEditors: bankeyu-dell 573569790@qq.com
 * @LastEditTime: 2022-10-13 01:27:33
 * @FilePath: \fast-vue3\src\api\group\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { get, post } from '/@/utils/http/axios';
enum URL {
  addmember = '/msvc/addmember', // 群组新增成员接口
  creategroup = '/msvc/creategroup', // 新增群接口
  delmember = '/msvc/delmember', // 群组删除成员接口
  findFriends = '/msvc/find-friends', // 查找好友信息接口
  groupAdmin = '/msvc/group-admin', // 设置群管理员接口
  groupLableUpdate = '/msvc/group-lable-update', // 群组标签更新接口
  groupPortraitUpdate = '/msvc/group-portrait-update', // 更新群头像信息接口
  groupdel = '/msvc/groupdel', // 删除群组接口
  groupdetail = '/msvc/groupdetail', // 查看群信息接口
  groups = '/msvc/groups', // 查找群信息接口
  groupupdate = '/msvc/groupupdate', // 更新群信息接口
  lableGroups = '/msvc/lable-groups', // 根据标签查找群信息接口
}

export interface AddmemberData {
  customerGroupId: number;
  customerRelIds: number[];
  random: string;
  timestamp: string;
}

export interface CreategroupData {
  customerGroupName: string;
  customerId: number;
  customerRelIds: number[];
  id: number;
  inviteConfirm: string;
  lables: number[];
  privateFlag: string;
  purpose: string;
}

export interface IdData {
  id: number;
}

export interface DelmemberData {
  customerGroupId: number;
  customerRelIds: number[];
  random: string;
  timestamp: string;
}

export interface FindFriendsData {
  email: string;
  mobile: string;
  pageNo: number;
  pageSize: number;
}

export interface GroupAdminData {
  customerGroupId: number;
  customerRelIds: number[];
  random: string;
  timestamp: string;
}

export interface GroupLableUpdateData {
  id: number;
  lables: number[];
}

export interface IdData {
  id: number;
}

export interface GroupsData {
  customerGroupName: string;
  customerId: number;
  pageNo: number;
  pageSize: number;
}

export interface GroupupdateData {
  customerGroupName: string;
  customerId: number;
  customerRelIds: number[];
  lables: number[];
  inviteConfirm: string;
  id: number;
  privateFlag: string;
  purpose: string;
}

export interface LableGroupsData {
  lables: number[];
  pageNo: number;
  pageSize: number;
}

const addmember = async (data: AddmemberData) => post<any>({ url: URL.addmember, data });
const creategroup = async (data: CreategroupData) => get<any>({ url: URL.creategroup, data });
const delmember = async (data: DelmemberData) => post<any>({ url: URL.delmember, data });
const findFriends = async (data: FindFriendsData) => get<any>({ url: URL.findFriends, data });
const groupAdmin = async (data: GroupAdminData) => post<any>({ url: URL.groupAdmin, data });
const groupLableUpdate = async (data: GroupLableUpdateData) => post<any>({ url: URL.groupLableUpdate, data });
const groupPortraitUpdate = async (data: IdData) => get<any>({ url: URL.groupPortraitUpdate, data });
const groupdel = async (data: IdData) => post<any>({ url: URL.groupdel, data });
const groupdetail = async (data: IdData) => get<any>({ url: URL.groupdetail, data });
const groups = async (data: GroupsData) => post<any>({ url: URL.groups, data });
const groupupdate = async (data: GroupupdateData) => post<any>({ url: URL.groupupdate, data });
const lableGroups = async (data: LableGroupsData) => post<any>({ url: URL.lableGroups, data });
export {
  addmember,
  creategroup,
  delmember,
  findFriends,
  groupAdmin,
  groupLableUpdate,
  groupPortraitUpdate,
  groupdel,
  groupdetail,
  groups,
  groupupdate,
  lableGroups,
};
